import org.apache.commons.lang3.StringUtils;

/**
 * Email 工具
 * <p>
 * Created by rockywong on 2019-05-22.
 */
public class EmailUtils {
	public final static String EMAIL_REGEX = "[\\w\\.\\-]+@([\\w\\-]+\\.)+[\\w\\-]+";

    /**
     * <b>是否为邮箱地址格式</b>
     * <p>
     * </p>
     *
     * @Author Rocky Wong
     * @Date 2019-05-22 10:22
     *
     * @param email
     * @return
     */
    public static boolean isEmail(String email) {
        if(StringUtils.isEmpty(email)) {
            return false;
        }

        if(StringUtils.isEmpty(email.trim())) {
            return false;
        }

        if(!email.matches(EMAIL_REGEX)) {
            return false;
        }

        return true;
    }
}